package com.guojiaming.shop.controller;

import com.guojiaming.shop.bean.AfterSale;
import com.guojiaming.shop.bean.ResponseBody;
import com.guojiaming.shop.bean.ResponseFactory;
import com.guojiaming.shop.bean.Sales;
import com.guojiaming.shop.service.SaleService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * @author vivo
 */
@RestController
@RequestMapping("sale")
public class SaleController {
    @Resource
    private SaleService saleService;

    @GetMapping("after")
    public ResponseBody<AfterSale> after(@Valid AfterSale afterSale) {
        return ResponseFactory.success(saleService.after(afterSale), "添加成功");
    }

    @GetMapping("add")
    public ResponseBody<Sales> add(@Valid Sales sales) {
        return ResponseFactory.success(saleService.add(sales), "添加成功");
    }
}
